package com.houseman.workFlow.processer;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 流程处理器抽象类
 * 
 * 策略模式：策略抽象类
 */
public abstract class Processer {

	
	//输入信息
	protected String outInfo = "";
	/**
	 * 错误
	 */
	protected String errorInfo = alertMagAndClose("流程处理错误，点击确定关闭页面！");
	/**
	 * 关闭页面
	 */
	protected String closeWin = "<script type='text/javascript'>parent.window.open('','_self','');parent.window.close();</script>";
	
	/**
	 * 结束流程
	 */
	protected String endWF(String workId) {
		return "<script type='text/javascript'>if(confirm('close the workFlow?')){window.location.href='workFlow//close.action?workId="
				+ workId + "';}else{parent.window.open('','_self','');parent.window.close();}</script>";
	};
	/**
	 * 下一办理
	 */
	protected String nextMag(String workId) {
		return "<script type='text/javascript'>if(confirm('是否直接进入下一办理?')){window.location.href='workFlow/request.action?workId="
				+ workId + "';}else{parent.window.open('','_self','');parent.window.close();}</script>";
	}
	/**
	 * 提示信息并关闭页面
	 */
	protected String alertMagAndClose(String msg) {
		return "<script type='text/javascript'>alert('" + msg + "');parent.window.open('','_self','');parent.window.close();</script>";
	}
	
	
	/**
	 * 请求处理方法
	 * @param request
	 * @param response
	 */
	public abstract void proccess(HttpServletRequest request, HttpServletResponse response);
	
}
